/**
 * 
 */
package com.taobao.snowsnow.hibernate.service.impl;

import java.util.List;

import com.taobao.snowsnow.hibernate.dao.ShopperDao;
import com.taobao.snowsnow.hibernate.pojo.Shopper;
import com.taobao.snowsnow.hibernate.service.ShopperService;

/**
 * @author Tux
 *
 * 创建时间: 2011-4-29 上午09:55:17
 */
public class ShopperServiceImpl extends BaseServiceImpl implements ShopperService {
	private ShopperDao sdao;
	
	public List<Shopper> findAll() throws Exception {
		try {
			return sdao.findAll();
		} catch(Exception e) {
			e.printStackTrace();
			throw e;
		}
	}

	public Shopper findById(int id) throws Exception {
		try {
			return sdao.findById(id);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findById(int id)");
			throw e;
		}
	}
	
	public List<Shopper> findByName(String name) throws Exception {
		try {
			return sdao.findByName(name);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at findByName(String name)");
			throw e;
		}
	}

	public long getTotal() throws Exception  {
		try {
			return sdao.getTotal();
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at getTotal()");
			throw e;
		}
	}

	public List<Shopper> paging(int page, int limit) throws Exception  {
		try {
			return sdao.paging(page, limit);
		}  catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error at paging(int page, int limit)");
			throw e;
		}
	}

	public void setSdao(ShopperDao edao) {
		this.sdao = edao;
	}

	public ShopperDao getSdao() {
		return sdao;
	}

	@Override
	public Shopper getFirstObject() throws Exception {
		try {
			return sdao.getFirstObject();
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Shopper getFirstObject()");
			throw e;
		}
	}

	@Override
	public Shopper getLastObject() throws Exception {
		try {
			return sdao.getLastObject();
		} catch(Exception e) {
			e.printStackTrace();
			System.out.println("Shopper getLastObject()");
			throw e;
		}
	}

	@Override
	public Shopper findByNamePrecise(String name) throws Exception {
		try {
			return sdao.findByNamePrecise(name);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Shopper getLastObject()");
			throw e;
		}
	}
}
